package club.janna.trace.service.d.impl;

import club.janna.trace.api.DService;
import club.janna.trace.api.EService;
import club.janna.trace.service.domain.DEntity;
import club.janna.trace.service.d.mapper.DMapper;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Panbo.Guo
 */
@DubboService
public class DServiceImpl implements DService {

    @Autowired
    private DMapper dMapper;
    @DubboReference
    private EService eService;

    @Override
    public String getValue(Long id) {
        DEntity a = dMapper.selectById(id);
        if(a == null)
            throw new RuntimeException("d not found! id -> " + id);
        return eService.getValue(a.getRefId());
    }
}
